import {Component, OnInit} from '@angular/core';
import {NgForm} from '@angular/forms';

@Component({
  selector: 'app-form',
  templateUrl: './form.component.html',
  styleUrls: ['./form.component.css']
})
export class FormComponent implements OnInit {

  uValidator: boolean = true;
  uUntouched: boolean = true;

  constructor() {
  }

  ngOnInit() {
  }

  onClick(form: NgForm) {
    if (form) {
      console.log(form.value);
    }
  }

  onUsername(form: NgForm) {
    if (form) {
      this.uValidator = form.form.get('username').valid;
      this.uUntouched = form.form.get('username').untouched;
    }
  }
}
